#!/bin/sh
# This script is used to automatically produce fields information
# for each word in dictionary, and put the result in corresponding directory,
# which then is  indexed by LUCENE 
# 
# *NOTE* : Please setup the python enviroment by run 
#
# $> source environmentVars.sh
#
# in Pinyomi-lite root directory before you run this script
#


ROOT=..

# 1. Prepare data

jpdict=je_edict
jptext=$ROOT/data/lucene_data/dictData/jp/jp_fields_edict.txt

chdict=ce_cedict 
chtext=$ROOT/data/lucene_data/dictData/ch/ch_fields_cedict.txt

./constructDictFields.py -d $jpdict -j -m >$jptext
./constructDictFields.py -d $chdict -c -m >$chtext


# 2. Build index
chdata=$ROOT/data/lucene_data/dictData/ch/
chindex=$ROOT/data/lucene_data/dictIndex/ch/

jpdata=$ROOT/data/lucene_data/dictData/jp/
jpindex=$ROOT/data/lucene_data/dictIndex/jp/

lucene=$ROOT/java/pinyomi-lite-web/WebContent/WEB-INF/lib/lucene-core-2.2.0.jar
pinyomi=$ROOT/java/pinyomi-lite-web/pinyomi-lite.jar

java -classpath  ${pinyomi}:${lucene}  ${jpdata}  ${jpindex}
java -classpath  ${pinyomi}:${lucene}  ${chdata}  ${chindex}


